<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>vue入门</title>
		<script src="../js/vue.js"></script>
	</head>
	<body>
		<div id="root">
			<input v-model="inputValue"/>
			<button @click="onSubmit">提交</button>
			<ul>
				<li v-for="(item, index) of list" :key="index">{{item}}</li>
			</ul>
		</div>
		<script type="text/javascript">
			new Vue({
				el: "#root",
				data: {
					inputValue: "请输入数据",
					list: []
				},
				methods: {
					onSubmit: function() {
						this.list.push(this.inputValue)
						this.inputValue = ""
					}
				}
			})
		</script>
	</body>
</html>
